package com.example.pay_service.Dao;

import com.example.pay_service.vo.Shopping;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author TLJ
 * @title: ShoppingDao
 * @projectName mall
 * @description: TODO
 * @date 2021/12/1615:45
 */
@Repository
@Mapper
public interface ShoppingDao
{
    @Insert("INSERT INTO shopping_cart(user_id,commodity_id,quantity_of_goods,shopping_Cart_money,collection_item_price,shopping_Cart_create,member_welfare_update)  VALUES(#{user_id},#{commodity_id},#{quantity_of_goods},#{shopping_Cart_money},#{collection_item_price},#{shopping_Cart_create},#{member_welfare_update})")
    int addshopping(Shopping shopping);

    @Select("select * from shopping_cart where user_id=#{user_id}")
    List<Shopping> showshopping(int user_id);

    @Delete("delete from shopping_cart where cart_id=#{cart_id}")
    int delshopping(int cart_id);

    @Select("select * from shopping_cart where cart_id=#{cart_id}")
    Shopping query_cart(int cart_id);
}
